package cn.bxshey.resourceSharing.controller;

import cn.bxshey.resourceSharing.entity.Feedback;
import cn.bxshey.resourceSharing.entity.R;
import cn.bxshey.resourceSharing.utils.MyMail;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.mail.MessagingException;
import java.util.Map;

/**
 * @作者：不想说话而已
 * @Date：2023/12/18 15:59
 */

@RestController
public class FeedbackController {

    @Resource
    MyMail mail;


    @PostMapping("/job")
    public R<?> feedback(@RequestBody Feedback feedback) throws MessagingException {
        String text = "<div> 标题："+feedback.getHeader()+"<div><div> 内容：" + feedback.getBody()+"<div>";
        mail.sendSimpleMail(feedback.getSubject(),"905102975@qq.com",text,true);
        return R.success();
    }


}
